<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    输入一个日期 ，输出这是这一年的第几天？
    例如2023-10-5 ，是第 ??? 天

    <script>
     let now = '2020-3-5';
     let sz = now.split('-')  //分割
     let days = [0,31,28,31,30,31,30,31,31,30,31,30,31];
     let year = sz[0] * 1;
     let month = sz[1] * 1;
     let date = parseInt( sz[2] );
     let n =0;  //总天数
     console.log( year,month,date );
     for(let i =1;i< month;i++){
        n+= days[i]
     }
      n += date ;
      //考虑闰年
     if(month>2){
        if(year%4==0&& year%100!=0  || year%400 ==0){
            n++;
        }
     }
     console.log( now+'是本年的第'+ n+ '天');


    </script>
</body>
</html>